<#
 #   It is recommended to test the script on a local machine for its purpose and effects. 
 #   ManageEngine Endpoint Central will not be responsible for any 
 #   damage/loss to the data/setup based on the behavior of the script.

 #   Description: Script is designed To convert folder into a share folder located on their machine.
 #   Configuration Type - COMPUTER / USER
 #   Note: Based on the folder path type, define it as either computer-based or user-based configurations.
 #>

# Variables (Hardcode the script arguments here)
$folderPath = "C:\ShareMe"
$shareName = "MySharedFolder"

# Create the folder if it doesn't exist
if (-Not (Test-Path -Path $folderPath)) {
    New-Item -Path $folderPath -ItemType Directory
}

# Create a shared folder
New-SmbShare -Name $shareName -Path $folderPath -FullAccess "Everyone"

# Confirm the share was created
Get-SmbShare -Name $shareName